<extend name="Public:base" />

<block name="content">

<div class="page-header">
	<a href="{:U('Renovation/addhousetype')}" class="btn btn-primary">添加房屋类型</a>
</div>

<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th><input name="name" type="text" placeholder="输入名称" value="{:I('name')}" /></th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Renovation/searchhouse')}">查询</a>
		</th>
	</thead>
</table>

<div class="row">
	<div class="col-xs-12">
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>编号</th>
						<th>房屋类型</th>
						<th>说明</th>
						<th>排序</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						<volist name="Renovation" id="vo">
						<tr>
							<td>{$vo.house_id}</td>
							<td>{$vo.name}</td>
							<td>{$vo.desc}</td>
							<td>{$vo.sort}</td>
							<td>
                                <?php
								switch($vo['status']){
									case '1':
									echo '<span class="green bold">√</span>';
                                    break;
                                    case '2':
                                    echo '<span class="red bold">×</span>';
                                    break;
                                 }
                                ?>
							</td>
							<td>
                                <a href="{:U('Renovation/edithouse')}/id/{$vo.house_id}" class="btn btn-xs btn-info" style="margin-right: 10px;float:none;">
                                <i class="ace-icon fa">编辑</i>
                                </a>
                                <button class="btn btn-xs btn-danger" onclick="" style="margin-right: 10px;float:none;">
                                    <a href="{:U('Renovation/delhouse')}/id/{$vo.house_id}" onclick="if(confirm('确定删除?')==false)return false;"/>
                                    <i class="ace-icon fa">删除</i></a>
                                </button>
							</td>
						</tr>
						</volist>
						<tr>
							<td colspan="20" class="page">{$page}</td>
						</tr>
				</tbody>

			</table>
		</div>
	</div>
</div>
</block>
<block name="javascript">
<script>
$(function(){

	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });


});
</script>

</block>